From: Rui Matos Date: Sun, 29 Apr 2012 22:25:59 +0000 (+0200) Subject: searchDisplay: Reset the keyboard focus after displaying async results X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~6630 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=54788d750eb2b5a103440802e2ac7caf9d7801dd;p=gnome-shell.git searchDisplay: Reset the keyboard focus after displaying async results We hide the content around displaying new search results to prevent flickering, unfortunately, one side effect of hiding an actor is losing key focus if it currently is on the that actor or any child. This could happen in the case of async results showing up after the user had moved focus to the search results. This patch works around that issue by saving the key focus and resetting it back after displaying the new async results. https://bugzilla.gnome.org/show_bug.cgi?id=675078 --- diff --git a/js/ui/searchDisplay.js b/js/ui/searchDisplay.js index 3c16e5656..c2185d9ed 100644 --- a/js/ui/searchDisplay.js +++ b/js/ui/searchDisplay.js @@ -395,10 +395,17 @@ const SearchResults = new Lang.Class({ function(metas) { this._clearDisplayForProvider(provider); meta.actor.show(); + + // Hinding drops the key focus if we have it + let focus = global.stage.get_key_focus(); this._content.hide(); + meta.resultDisplay.renderResults(metas); this._maybeSetInitialSelection(); + this._content.show(); + if (this._content.contains(focus)) + global.stage.set_key_focus(focus); })); } else { let metas = provider.getResultMetas(results);